home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 October: Mac OS SDK / Dev.CD Oct 00 SDK1.toast / Development Kits / Mac OS / MLTE SDK / TEtoMLTESample / CommonSources / TESample.r < prev   
Encoding:
Text File  |  1999-12-24  |  6.9 KB  |  331 lines  |  [TEXT/MPS ]

  1. /*------------------------------------------------------------------------------
  2. #
  3. #    Apple Macintosh Developer Technical Support
  4. #
  5. #    MultiFinder-Aware Simple TextEdit Sample Application
  6. #
  7. #    CPlusTESample
  8. #
  9. #    TESample.r    -    Rez source
  10. #
  11. #    Copyright © 1989, 1994 Apple Computer, Inc.
  12. #    All rights reserved.
  13. #
  14. #    Versions:
  15. #           2.10                    01/94       for PowerPC
  16. #            2.00                    03/93        for PowerPC
  17. #            1.10                     07/89
  18. #            1.00                     04/89
  19. #
  20. #    Components:
  21. #            CPlusTESample.make        July 9, 1989
  22. #            TApplicationCommon.h    July 9, 1989
  23. #            TApplication.h            July 9, 1989
  24. #            TDocument.h                July 9, 1989
  25. #            TECommon.h                July 9, 1989
  26. #            TESample.h                July 9, 1989
  27. #            TEDocument.h            July 9, 1989
  28. #            TESample.cp                July 9, 1989
  29. #            TESample.r                July 9, 1989
  30. #
  31. #    CPlusTESample is an example application that demonstrates
  32. #    how to initialize the commonly used toolbox managers,
  33. #    operate successfully under MultiFinder, handle desk
  34. #    accessories and create, grow, and zoom windows. The
  35. #    fundamental TextEdit toolbox calls and TextEdit autoscroll
  36. #    are demonstrated. It also shows how to create and maintain
  37. #    scrollbar controls. 
  38. #
  39. #    This version of TESample has been substantially reworked in
  40. #    C++ to show how a "typical" object oriented program could
  41. #    be written. To this end, what was once a single source code
  42. #    file has been restructured into a set of classes which
  43. #    demonstrate the advantages of object-oriented programming.
  44. #
  45. ------------------------------------------------------------------------------*/
  46.  
  47. #include "SysTypes.r"
  48. #include "Types.r"
  49. #include "Dialogs.r"
  50. #include "Menus.r"
  51. #include "MacWindows.r"
  52.  
  53.  
  54. #include "TECommon.h"
  55. #include "TApplicationCommon.h"
  56.  
  57. resource 'vers' (1) {
  58.     0x02, 0x00, release, 0x00,
  59.     verUS,
  60.     "2.10",
  61.     "2.10, Copyright © 1989, 1994 Apple Computer, Inc."
  62. };
  63.  
  64. /* we use an MBAR resource to conveniently load all the menus */
  65.  
  66. resource 'MBAR' (rMenuBar, preload) {
  67.     { mApple, mFile, mEdit, mDebug };        /* three menus + debug */
  68. };
  69.  
  70.  
  71. resource 'MENU' (mApple, preload) {
  72.     mApple, textMenuProc,
  73.     0b1111111111111111111111111111101,    /* disable dashed line, enable About and DAs */
  74.     enabled, apple,
  75.     {
  76.         "About CPlusTESample…",
  77.             noicon, nokey, nomark, plain;
  78.         "-",
  79.             noicon, nokey, nomark, plain
  80.     }
  81. };
  82.  
  83. resource 'MENU' (mFile, preload) {
  84.     mFile, textMenuProc,
  85.     0b0000000000000000000100000000000,    /* enable Quit only, program enables others */
  86.     enabled, "File",
  87.     {
  88.         "New",
  89.             noicon, "N", nomark, plain;
  90.         "Open",
  91.             noicon, "O", nomark, plain;
  92.         "-",
  93.             noicon, nokey, nomark, plain;
  94.         "Close",
  95.             noicon, "W", nomark, plain;
  96.         "Save",
  97.             noicon, "S", nomark, plain;
  98.         "Save As…",
  99.             noicon, nokey, nomark, plain;
  100.         "Revert",
  101.             noicon, nokey, nomark, plain;
  102.         "-",
  103.             noicon, nokey, nomark, plain;
  104.         "Page Setup…",
  105.             noicon, nokey, nomark, plain;
  106.         "Print…",
  107.             noicon, nokey, nomark, plain;
  108.         "-",
  109.             noicon, nokey, nomark, plain;
  110.         "Quit",
  111.             noicon, "Q", nomark, plain
  112.     }
  113. };
  114.  
  115. resource 'MENU' (mEdit, preload) {
  116.     mEdit, textMenuProc,
  117.     0b0000000000000000000000000000000,    /* disable everything, program does the enabling */
  118.     enabled, "Edit",
  119.      {
  120.         "Undo",
  121.             noicon, "Z", nomark, plain;
  122.         "-",
  123.             noicon, nokey, nomark, plain;
  124.         "Cut",
  125.             noicon, "X", nomark, plain;
  126.         "Copy",
  127.             noicon, "C", nomark, plain;
  128.         "Paste",
  129.             noicon, "V", nomark, plain;
  130.         "Clear",
  131.             noicon, nokey, nomark, plain
  132.     }
  133. };
  134.  
  135. resource 'MENU' (mDebug, preload) {
  136.     mDebug, textMenuProc,
  137.     0b0000000000000000000000000000001,    /* enable debug item */
  138.     enabled, "Debug",
  139.     {
  140.         "Enter Debugger…",
  141.             noicon, nokey, nomark, plain
  142.     }
  143. };
  144.  
  145.  
  146.  
  147. /* this ALRT and DITL are used as an About screen */
  148.  
  149. resource 'ALRT' (rAboutAlert, purgeable) {
  150.     {40, 20, 160, 330 }, rAboutAlert, {
  151.         OK, visible, silent;
  152.         OK, visible, silent;
  153.         OK, visible, silent;
  154.         OK, visible, silent
  155.     },
  156.     centerMainScreen;
  157. };
  158.  
  159. resource 'DITL' (rAboutAlert, purgeable) {
  160.     { /* array DITLarray: 5 elements */
  161.         /* [1] */
  162.         {88, 224, 108, 304},
  163.         Button {
  164.             enabled,
  165.             "OK"
  166.         },
  167.         /* [2] */
  168.         {8, 8, 24, 304 },
  169.         StaticText {
  170.             disabled,
  171.             "MultiFinder-Aware C++ TextEdit Application"
  172.         },
  173.         /* [3] */
  174.         {32, 8, 48, 304},
  175.         StaticText {
  176.             disabled,
  177.             "Copyright © 1989, 1993 Apple Computer, Inc."
  178.         },
  179.         /* [4] */
  180.         {56, 8, 72, 136},
  181.         StaticText {
  182.             disabled,
  183.             "Brought to you by:"
  184.         },
  185.         /* [5] */
  186.         {80, 24, 112, 167},
  187.         StaticText {
  188.             disabled,
  189.             "Macintosh Developer Technical Support"
  190.         }
  191.     }
  192. };
  193.  
  194. /* this ALRT and DITL are used as an error screen */
  195.  
  196. resource 'ALRT' (rUserAlert, purgeable) {
  197.     {40, 20, 150, 260},
  198.     rUserAlert,
  199.     {    /* array: 4 elements */
  200.         /* [1] */
  201.         OK, visible, silent,
  202.         /* [2] */
  203.         OK, visible, silent,
  204.         /* [3] */
  205.         OK, visible, silent,
  206.         /* [4] */
  207.         OK, visible, silent
  208.     },
  209.     centerMainScreen;
  210. };
  211.  
  212. resource 'DITL' (rUserAlert, purgeable) {
  213.     { /* array DITLarray: 3 elements */
  214.         /* [1] */
  215.         {80, 150, 100, 230},
  216.         Button {
  217.             enabled,
  218.             "OK"
  219.         },
  220.         /* [2] */
  221.         {10, 60, 60, 230},
  222.         StaticText {
  223.             disabled,
  224.             "Error. ^0."
  225.         },
  226.         /* [3] */
  227.         {8, 8, 40, 40},
  228.         Icon {
  229.             disabled,
  230.             2
  231.         }
  232.     }
  233. };
  234.  
  235. resource 'WIND' (rDocWindow, preload, purgeable) {
  236.     {64, 60, 314, 460},
  237.     zoomDocProc, invisible, goAway, 0x0, "untitled",
  238.     staggerMainScreen
  239. };
  240.  
  241.  
  242. resource 'CNTL' (rVScroll, preload, purgeable) {
  243.     {-1, 385, 236, 401},
  244.     0, visible, 0, 0, scrollBarProc, 0, ""
  245. };
  246.  
  247.  
  248. resource 'CNTL' (rHScroll, preload, purgeable) {
  249.     {235, -1, 251, 386},
  250.     0, visible, 0, 0, scrollBarProc, 0, ""
  251. };
  252.  
  253. resource 'STR#' (kTEDocErrStrings, purgeable) {
  254.     {
  255.     "Not enough memory to run TESample";
  256.     "Not enough memory to do Cut";
  257.     "Cannot do Cut";
  258.     "Cannot do Copy";
  259.     "Cannot exceed 32,000 characters with Paste";
  260.     "Not enough memory to do Paste";
  261.     "Cannot create window";
  262.     "Cannot exceed 32,000 characters";
  263.     "Cannot do Paste"
  264.     }
  265. };
  266.  
  267. resource 'STR#' ( kErrStrings, purgeable ) {
  268.     {
  269.     "This machine is too old to run this program.";
  270.     "There is not enough memory to run TESample.";
  271.     "The program was unable to initialize MLTE."
  272.     }
  273. };
  274.  
  275.  
  276.  
  277. type 'MOOT' as 'STR ';
  278.  
  279.  
  280. resource 'MOOT' (0) {
  281.     "MultiFinder-Aware TextEdit Sample Application"
  282. };
  283.  
  284.  
  285. resource 'BNDL' (128) {
  286.     'MOOT',
  287.     0,
  288.     {
  289.         'ICN#',
  290.         {
  291.             0, 128
  292.         },
  293.         'FREF',
  294.         {
  295.             0, 128
  296.         }
  297.     }
  298. };
  299.  
  300.  
  301. resource 'FREF' (128) {
  302.     'APPL',
  303.     0,
  304.     ""
  305. };
  306.  
  307.  
  308. resource 'ICN#' (128) {
  309.     { /* array: 2 elements */
  310.         /* [1] */
  311.         $"04 30 40 00 0A 50 A0 00 0B 91 10 02 08 22 08 03"
  312.         $"12 24 04 05 20 28 02 09 40 10 01 11 80 0C 00 A1"
  313.         $"80 03 FF C2 7E 00 FF 04 01 00 7F 04 03 00 1E 08"
  314.         $"04 E0 00 0C 08 E0 00 0A 10 E0 00 09 08 C0 00 06"
  315.         $"04 87 FE 04 02 88 01 04 01 88 00 84 00 88 00 44"
  316.         $"00 88 00 44 00 88 00 C4 01 10 01 88 02 28 03 10"
  317.         $"01 C4 04 E0 00 02 08 00 73 BF FB EE 4C A2 8A 2A"
  318.         $"40 AA AA EA 52 AA AA 24 5E A2 8A EA 73 BE FB 8E",
  319.         /* [2] */
  320.         $"04 30 40 00 0E 70 E0 00 0F F1 F0 02 0F E3 F8 03"
  321.         $"1F E7 FC 07 3F EF FE 0F 7F FF FF 1F FF FF FF BF"
  322.         $"FF FF FF FE 7F FF FF FC 01 FF FF FC 03 FF FF F8"
  323.         $"07 FF FF FC 0F FF FF FE 1F FF FF FF 0F FF FF FE"
  324.         $"07 FF FF FC 03 FF FF FC 01 FF FF FC 00 FF FF FC"
  325.         $"00 FF FF FC 00 FF FF FC 01 FF FF F8 03 EF FF F0"
  326.         $"01 C7 FC E0 00 03 F8 00 73 BF FB EE 7F BE FB EE"
  327.         $"7F BE FB EE 7F BE FB E4 7F BE FB EE 73 BE FB 8E"
  328.     }
  329. };
  330.  
  331.